#!/bin/bash

read -p "用户名:" username
read -p "密码:" password
read -p "认证地址:" authenticationAddress

if [ -z "$username" ] || [ -z "$password" ] || [ -z "$authenticationAddress" ]; then
    echo "用户名、密码、认证地址不能为空"
    exit 1
fi

# 修改认证脚本
cat > /data/ws-scrcpy/config.json << EOF
{
    'username': '$username',
    'password': "$password",
    'authentication': "$authenticationAddress"
}
EOF

systemctl stop scrcpyd
systemctl start scrcpyd
systemctl status scrcpyd